qacli baseline

Controls the suppression of diagnostics from previous analysis runs.

Usage

baseline  {-d <snapshot-name>|--pull-suppressions <snapshot-name>|-l|-b|-g} [-P <directory>] [-K <config name>] [-B <OFF|VCS|LOCAL|UNIFIED|VALIDATE>] [-U <[protocol://]host[:port]>] [-s <local-source>] [-u <username>] [-p <password>] [-w <password-file>] [-t <token>] [-c] [--] [-h]

Extended Description

Baseline diagnostics suppression are used to suppress old diagnostic warnings when the decision has been made to begin a new cycle of development.

The baseline consists of the set of diagnostics present when the baseline was generated. In any subsequent analysis, if a diagnostic can be identified as being the same as a diagnostic within the baseline, it is suppressed. Sophisticated "diff"- style techniques are used to match diagnostics, even if some of the surrounding code has changed.

There are several different types of baselines that can be applied, which are generally mutually exclusive: OFF, VSC, LOCAL, UNIFIED, VALIDATE. These are further described in Examples.

As well as diagnostic baselines, the downloading and applying of Interactive suppressions from a Unified Dashboard project is also supported.

The Validate baseline will also take citation data from the server and apply them as Interactive suppressions.

Options

Name, shorthand Default Description
‑‑baseline‑type, ‑B   Choose the baseline type (OFF|VCS|LOCAL|UNIFIED|VALIDATE) to run the command against. To be used with generate-baseline and set-baseline.
‑‑config, ‑K   For projects with multiple configurations, specify which configuration to use. If none are specified, the default will be used.
‑‑generate‑baseline, ‑g   Generate a baseline for Validate, VCS or local baselines.
‑‑help, ‑h   Displays usage information and exits.
‑‑ignore‑rest, ‑‑   Ignores the rest of the labeled arguments following this flag.
‑‑list‑snapshots, ‑l   List available snapshots for project. Project must be a valid unified project.
‑‑local‑cache, ‑c   Disables fetching diagnostics from Validate server during analysis.
‑‑local‑source, ‑s   Optional location of a generated baseline suppression file. For local baselines, the suppression file must already exist.
‑‑password, ‑p   Dashboard password. Consider using tokens for Dashboard authentication or a password file.
‑‑password‑file, ‑w   A path to a file that contains a Dashboard password. It should be appropriately protected.
‑‑pull‑baseline, ‑d   Get required snapshot. Project must be a valid unified project.
‑‑pull‑suppressions   Get interactive suppressions from Dashboard snapshot. Project must be a valid unified project.
‑‑qaf‑project, ‑P . Specify a path to a valid Helix QAC project to act upon.
‑‑set‑baseline, ‑b   Use the previously generated baseline suppression file.
‑‑token, ‑t   For Dashboard, use the supplied authentication token rather than user credentials. See ‑‑dashboard, ‑D for creation details.
‑‑url, ‑U   URL of the results server. By default the http protocol is assumed. Examples include; localhost:80, 127.0.0.1:8080, https://prometheus:8888
‑‑username, ‑u   Dashboard username. Consider using tokens for Dashboard authentication.
When using Dashboard (i.e. ‑‑baseline‑type = UNIFIED) the project must be a Unified project. See Centralizing Project Definitions for more information.

When using a VCS (i.e. ‑‑baseline‑type = VCS) a VCF file must have previously been configured. See Version Control Configuration for more information.

When using a VALIDATE (i.e. ‑‑baseline‑type = VALIDATE), the project must be a Validate connected project. See qacli validate connect for more information.

Examples

Setting and Using a Dashboard Baseline

This involves downloading code and diagnostics from a Dashboard snapshot to form the actual baseline. Once this has been done, you need to tell Helix QAC to apply the baseline.

These baselines are only available for Unified projects, which have links to projects within Dashboard.

The commands that obtain data from Dashboard need to connect to Dashboard, using the URL for the Dashboard server, as well as login credentials. As stated in Specifying Helix QAC Dashboard Credentials, the login credentials can involve either specifying a username and password, or the use of a token. The example calls listed here use the token method.

The available snapshots for the Unified project can be listed using the command:

qacli baseline -P <project_path> --list-snapshots –url <[protocol://]host[:port]> --token <tkn>

To download the baseline, use:

qacli baseline -P <project_path> --pull-baseline <snapshot> --url <[protocol://]host[:port]> --token <tkn>

Once the baseline has been downloaded, it can be applied using the following command:

qacli baseline -P <project_path> --set-baseline --baseline-type UNIFIED

To turn the baseline off, use:

qacli baseline -P <project_path> --set-baseline --baseline-type OFF

Setting and Using a Local Baseline

Setting a local baseline requires that an analysis has previously been generated. After performing an analysis, a local baseline can be generated using the following command:

qacli baseline -P <project_path> --baseline-type LOCAL --generate-baseline

The source code associated with the baseline must be stored, so that when the baseline is applied, diff-style techniques can be used to match baselined diagnostics with the diagnostics in the latest code. To store, use the following:

qacli baseline -P <project_path> --baseline-type LOCAL --set-baseline [--local-source <output-path>]
The optional output-path is the directory containing details of the differences in the source code. The default (prqa\configs\<config-name>\output) will suffice for most users, but can be overridden if needed.

To turn off the baseline, use the following:

qacli baseline -P <project_path> --baseline-type OFF --set-baseline

Setting and Using a VCS Baseline

This involves generating the baseline from the current analysis results, and then applying it. To generate the baseline:

qacli baseline -P <project_path> --generate-baseline --baseline-type VCS

To apply the baseline:

qacli baseline -P <project_path> --set-baseline --baseline-type VCS

To turn the baseline off:

qacli baseline -P <project_path> --set-baseline --baseline-type OFF

Downloading Dashboard Suppressions

The general functionality of Dashboard suppressions is described in Downloading Suppressions.

Dashboard suppressions are only available for Unified projects, which have links to projects within Dashboard.

The suppressions are downloaded from a Dashboard snapshot. The available snapshots for the Unified project can be listed using this command:

qacli baseline -P <project_path> --list-snapshots --url <[protocol://]host[:port]> --token <tkn>

To download the suppressions, use the following:

qacli baseline -P <project_path> --pull-suppressions <snapshot-name> --url <[protocol://]host[:port]> --token <tkn>

Once the suppressions have been downloaded, they will automatically be applied when the analysis results are viewed.

Setting and Using a Validate Baseline

To do this, you must first have a Validate connected project (see qacli validate connect). Once the setting is applied, the project will pull the latest diagnostics from Validate during analysis, create a cache file, and apply the baseline.

You can apply Validate baselining with the following command:

qacli baseline -P <project_path> --set-baseline --baseline-type VALIDATE

If you wish to disable the behaviour that fetches the latest diagnostics from Validate on every analysis run, you can first generate a cache locally:

qacli baseline -P <project_path> --generate-baseline --baseline-type VALIDATE --local-source <cache-dir>

–local-source is an optional parameter to specify the location of the generated cache file.

You can then apply it, using the following:

qacli baseline -P <project_path> --set-baseline --baseline-type VALIDATE --local-cache 
When using fetch-latest during analysis, the cache file will always be generated in the <project_path>/…/output/ folder.